package com.uduemc.biso.master.backend.service;

import java.io.IOException;
import java.util.List;

import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.github.pagehelper.PageInfo;
import com.uduemc.biso.core.common.extities.CHostListCustomerData;
import com.uduemc.biso.core.extities.center.CustomerUser;
import com.uduemc.biso.core.extities.center.SysRole;
import com.uduemc.biso.master.backend.request.CustomermanageAppend;

public interface CustomermanageService {

	/**
	 * 获取系统中所有的 sys_role 数据
	 * 
	 * @return
	 * @throws IOException
	 * @throws JsonProcessingException
	 * @throws JsonMappingException
	 * @throws JsonParseException
	 */
	public List<SysRole> getAllSysRole()
			throws JsonParseException, JsonMappingException, JsonProcessingException, IOException;

	/**
	 * 通过用户名 username 获取 customerUser 数据
	 * 
	 * @param username
	 * @return
	 * @throws IOException
	 * @throws JsonProcessingException
	 * @throws JsonMappingException
	 * @throws JsonParseException
	 */
	public CustomerUser getByUsername(String username)
			throws JsonParseException, JsonMappingException, JsonProcessingException, IOException;

	/**
	 * 插入 customer 数据，包含：customer_user、host、host_setup 三张数据表
	 * 
	 * @param customermanageAppend
	 * @return
	 * @throws JsonParseException
	 * @throws JsonMappingException
	 * @throws JsonProcessingException
	 * @throws IOException
	 */
	public CustomerUser insertCustomerData(CustomermanageAppend customermanageAppend)
			throws JsonParseException, JsonMappingException, JsonProcessingException, IOException;

	/**
	 * 通过参数获取 PageInfo<T> 结构的数据列表
	 * 
	 * @param agentId
	 * @param username
	 * @param numberKey
	 * @param status
	 * @param pageNumber
	 * @param pageSize
	 * @return
	 * @throws JsonParseException
	 * @throws JsonMappingException
	 * @throws JsonProcessingException
	 * @throws IOException
	 */
	public PageInfo<CHostListCustomerData> infosGet(long agentId, String username, String numberKey, short status,
			int pageNumber, int pageSize)
			throws JsonParseException, JsonMappingException, JsonProcessingException, IOException;

	/**
	 * 通过参数获取 CHostListCustomerData 结构的数据
	 * 
	 * @param id
	 * @param agentId
	 * @return
	 * @throws JsonParseException
	 * @throws JsonMappingException
	 * @throws JsonProcessingException
	 * @throws IOException
	 */
	public CHostListCustomerData infoGet(long id, long agentId)
			throws JsonParseException, JsonMappingException, JsonProcessingException, IOException;

	/**
	 * 通过id修改 CustomerUser 中的 status
	 * 
	 * @param id
	 * @param status
	 * @return
	 * @throws JsonParseException
	 * @throws JsonMappingException
	 * @throws JsonProcessingException
	 * @throws IOException
	 */
	public CustomerUser updateStatusCustomerUser(long id, short status)
			throws JsonParseException, JsonMappingException, JsonProcessingException, IOException;

	/**
	 * 通过id修改 CustomerUser 中的 username，需要同步!
	 * 
	 * @param id
	 * @param username
	 * @return
	 * @throws JsonParseException
	 * @throws JsonMappingException
	 * @throws JsonProcessingException
	 * @throws IOException
	 */
	public CustomerUser updateUsernameCustomerUser(long id, String username)
			throws JsonParseException, JsonMappingException, JsonProcessingException, IOException;
}
